#include "atltypes.h"
#if !defined(AFX_MYGRAPHBUTTONVIEW_H__AC2725F3_E8DD_4DEE_8A87_8DBD7127D228__INCLUDED_)
#define AFX_MYGRAPHBUTTONVIEW_H__AC2725F3_E8DD_4DEE_8A87_8DBD7127D228__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// MyGraphButtonView.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// MyGraphButtonView view

enum CaptType
{
	UNCAPTURED,
	SIGNAL_CAPTURED,
	SIGNAL_INSIDE_GROUP_CAPTURED
};


class GraphButtonView : public CScrollView
{
protected:
	GraphButtonView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(GraphButtonView)
	//CButton				MyButton[32];
// Attributes
public:
	friend	class	ZWaveeditorDoc;
	friend  class   CImage;
	ZWaveeditorDoc* GetDocument();
protected:
	int				wmaxx;
	CPoint			oldpoint;
	char			CaptureType;
	int				captured_signal_number;
	int				SignalPositionNumberInGroup;
	int				SelectedScenario;
// Operations
public:
	int				ReadGraphData(CDC* pDC);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(MyGraphView)
	protected:
	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
	virtual void OnInitialUpdate();     // first time after construct
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
	//}}AFX_VIRTUAL

// Implementation
protected:
	void			ChangeWindowTitle();
	virtual			~GraphButtonView();
#ifdef _DEBUG
	virtual void	AssertValid() const;
	virtual void	Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(MyGraphView)
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/);

	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	afx_msg void	OnLButtonDown(UINT nFlags, CPoint point);
	int				DrawSignalNamesPanel(CDC* pDC, int HorizontalSize);
	ChildGraphFrame * GetParentGraphFrame();
	int				GetBiggestSizeOfTexts( CDC* pDC );
	int				GetBiggestSizeOfTextForSignal ( CDC* pDC, int NumberOfSignal );
	void			CreateFont( CFont * font, CDC* pDC, int NumberOfSignal );
	afx_msg void	OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	void			DrawBar( CRect BarRect );
	afx_msg void	OnMouseMove		(UINT nFlags, CPoint point);
	afx_msg void	OnLButtonUp		(UINT nFlags, CPoint point);
	void			DrawFullButton	( CDC* pDC, int signalnum, int HorizontalSize);
	void			DrawButtonBar	(CPoint upperleft);
	void			DrawInGroupRectBar( int SignalNumber, int SignalInGroupNumber );

	afx_msg void	OnUpdateSetHighlightingRulesButton( CCmdUI* pCmdUI );
	afx_msg void	OnUpdateGroupWavesButton( CCmdUI* pCmdUI );
	afx_msg void	OnUpdateUnGroupButton( CCmdUI* pCmdUI );
	afx_msg void	OnUpdateChooseColorSignalButton( CCmdUI* pCmdUI );
	afx_msg void	OnUpdateRemoveSignalButton( CCmdUI* pCmdUI );
	afx_msg void	OnUpdateDeleteSignalButton( CCmdUI* pCmdUI );
	afx_msg void	OnUpdateSortWaveByNameButton( CCmdUI* pCmdUI );
	afx_msg void	OnUpdateSortWaveByValButton( CCmdUI* pCmdUI );
	afx_msg void	OnUpdateDeselectAllWavesButton( CCmdUI* pCmdUI );
	afx_msg void	OnUpdateDisplaceToFirstChangeAndMaxZoominButton( CCmdUI* pCmdUI );


	afx_msg void	OnGroupWaves();
	afx_msg void	OnUnGroup();
	afx_msg void	OnChooseColorSignal();
	afx_msg void	OnSetHighlightingRules();
	afx_msg void	OnRemoveSignal();
	afx_msg void	OnDeleteSignal();
	afx_msg void	OnSortSelectedWavesByName();
	afx_msg void	OnSortSelectedWavesByVal();
	afx_msg void	OnDisplaceToFirstChangeAndMaxZoomin();
	afx_msg void	OnDeselectAllWaves();
	afx_msg void	OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);

	afx_msg void	OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
public:
	int				GetHorizontalSizeForButtonImage( CImage *ImageForSave );
	void			DrawSignalNamesPanelIntoImage( CImage *ImageForSave );
	void			UpdateView		();
};

/////////////////////////////////////////////////////////////////////////////
#ifndef _DEBUG  // debug version in waveeditorView.cpp
inline ZWaveeditorDoc* GraphButtonView::GetDocument()
   { return (ZWaveeditorDoc*)m_pDocument; }
#endif

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MYGRAPHBUTTONVIEW_H__AC2725F3_E8DD_4DEE_8A87_8DBD7127D228__INCLUDED_)
